<%--
  Created by IntelliJ IDEA.
  User: gaohuohuo
  Date: 2020/3/14
  Time: 14:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<script type="text/javascript" src="js/jquery1.8.js"></script>
<body>
<h2>欢迎回家${sessionScope.user.name}</h2>
<table>
    <tr>
        <th>名字</th>
        <th>班级</th>
    </tr>
    <tbody id="tbodys">
     <tr>
         <td>张三</td>
         <td>一班</td>
     </tr>
    </tbody>
</table>
<button onclick="fun(2)">点一下呗</button>
<span id="spans"></span>
<script type="text/javascript">
    function fun(index) {

        jQuery.ajax({
            "url":"userPage",
            "type":"post",
            "data":{"index":index},
            "dataType":"JSON",
            "success":function (d) {
                 jQuery(d.list).each(function (i,v) {
                     alert(v.userName);
                 })
            },
            "error":function () {
                alert("老弟出错了");
            }
        })
    }
    fun();
</script>



<hr>
<table>

    <%--<th>班级1</th>
    <th>班级2</th>--%>
    <c:forEach items="${sessionScope.class_users}" var="cla">
        <tr>
            <th>${cla.cls.name}</th>
            <c:forEach items="${cla.users}" var="user">
                <th>${user.name}</th>
            </c:forEach>
        </tr>
    </c:forEach>
</table>


</body>
</html>
